package com.my.test.thread.ThreadLocal;

public class ThreadLocalTest  {

    static ThreadLocal<String> local = new ThreadLocal<String>();

    static int var = 0;

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()-> {
                local.set("local1");
                var = 11;
                System.out.println(local.toString()); // java.lang.ThreadLocal@7db811c1
        });

        t1.start();
        t1.join();
        System.out.println(local.get());// null
        System.out.println(var); // 11
        System.out.println(local.toString()); // java.lang.ThreadLocal@7db811c1
    }
}
